//- 先去这个pug文件中找
extends shopHead.pug

block append pageStyle
	link(href="${relativePath}/static/css/shopping/shopIndex.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/materFinished.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/colleague.css" rel="stylesheet" type="text/css")

block shopContent
	//- 轮播图
	div.bigBanner
		//- swiper
		div.swiper-container
			div.swiper-wrapper
				div.swiper-slide
					img(src="${relativePath}/static/imgs/banner2.jpg")
				div.swiper-slide
					img(src="${relativePath}/static/imgs/banner3.jpg")
			//- 分页器
			div.swiper-pagination.changeColor
			//- 导航按钮
			//- div.swiper-button-prev
			//- div.swiper-button-next
	//- 同行内容
	div.indexContent.layout
		div.latestProduct(pnav="zxsp")
			div.titleBox
				h3
					| 精准匹配，多方位查找，找同行更简单
					| <p>ACCURATE MATCHING, MNLTI lOCATION SEARCH, FIND PEERS MORE SIMPLE</p>
		div.collNav
			div.col-navBox
				div.col-left.fl
					img(src="${relativePath}/static/imgs/eg.png")
				div.col-right.fl
					p.col-title 附近公司
					p.colpro 查看附近广告标识同行的电话、地址、业务范围、行业标签等
			div.col-navBox
				div.col-left.fl
					img.adv(src="${relativePath}/static/imgs/grop.png")
				div.col-right.fl
					p.col-title 专业广告市场
					p.colpro 查看全国范围及各省市的专业广告市场，广告标识同行就在您身边
			div.clearfix
		div.kind-box.collNav
			//- 热门推荐
			div.hots.fl
				div.t-title
					div.ptitle.fl
						| 热门推荐
						span.eName RECOMMEND
					a(href="./recomCom.html").col-more.fr 更多 >>
					div.clearfix
				ul.list-box.hotlist-box
					
			//- 最新收录
			div.hots.fl
				div.t-title
					div.ptitle.fl
						| 最新收录
						span.eName LATEST COLLECTION
					a(href="./newlist.html").col-more.fr 更多 >>
					div.clearfix
				ul.list-box.newlist-box
					
			div.clearfix
		div.kind-box.collNav
			//- 产品分类
			div.hots.fl
				div.t-title
					div.ptitle.fl
						| 产品分类
						span.eName PRODUCT CATEGORY
					a(href="allkinds.html").col-more.fr 更多 >>
					div.clearfix
				ul.list-box
					div.select-box
						select.one.selectH.nowrap.fl
						select.two.selectH.nowrap.fl
						select.three.selectH.nowrap.fl
						div.clearfix
					div.kindsonelist
			//- 服务分类
			div.hots.fl
				div.t-title
					div.ptitle.fl
						| 服务分类
						span.eName SERVICE CATALOG
					a(href="./allservice.html").col-more.fr 更多 >>
					div.clearfix
				ul.list-box
					div.select-box
						select.service1.selectH.fl
						select.service2.selectH.fl
						select.service3.selectH.fl
						div.clearfix
					div.kindstwolist
			div.clearfix
		//- 推荐朋友
		div.kind-box.collNav
			//- 推荐朋友
			div.moreCom
				div.t-title.t-titlep
					div.ptitle.ptitleone.fl
						| 推荐朋友
						span.eName RECOMMENDATION FRIENDS
					a(href="./recomFri.html").col-more.fr 更多 >>
					div.clearfix
				div.friends-box
					
		//- 推荐公司
		div.kind-box.collNav
			//- 推荐公司
			div.moreCom
				div.t-title.t-titlep
					div.ptitle.ptitleone.fl
						| 推荐公司
						span.eName RECOMMENDATION COMPANY
					a(href="./recomCom.html").col-more.fr 更多 >>
					div.clearfix
			//- 推荐公司
			div.hotbox
				
	//- 分页
	div.pageBox
		nav.pageNav
			div.paginationOne.page

	//- 热门推荐列表模板
	script#hot(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		li
			img.fl.hot-img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}
				div.center
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   成立{{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area==''?'暂无':arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.btm
					| {{set tag = arr.tags}}
					| {{each tag list}}
					| {{if list.color="blue"}}
					a.blue(href="javascript:;") {{list.name}}
					| {{else if list.color="green"}}
					a.green(href="javascript:;") 印刷设计
					| {{else if list.color="yellow"}}
					a.yellow(href="javascript:;") 亚克力板
					| {{/if}}
					| {{/each}}
			div.clearfix
		| {{/each}}
	//- 最新收录列表模板
	script#newlist(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		li
			img.fl.hot-img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}
				div.center
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   成立{{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area==''?'暂无':arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.btm
					| {{set tag = arr.tags}}
					| {{each tag list}}
					| {{if list.color="blue"}}
					a.blue(href="javascript:;") {{list.name}}
					| {{else if list.color="green"}}
					a.green(href="javascript:;") 印刷设计
					| {{else if list.color="yellow"}}
					a.yellow(href="javascript:;") 亚克力板
					| {{/if}}
					| {{/each}}
			div.clearfix
		| {{/each}}
	//- 推荐朋友模板
	script#frilist(type="text/html")
		| {{set data = data.members}}
		| {{each data arr}}
		div.row-box.fl(id="{{arr.id}}")
			div.pic
				img.headerPic(src="{{arr.avatar_img}}")
			p.name
				| {{arr.nice_name}}
				| {{if arr.leaguer_type ==2}}
				img(src='${relativePath}/static/imgs/zsr.png')
				| {{else if arr.leaguer_type ==1}}
				img(src='${relativePath}/static/imgs/zsb.png')
				| {{else if arr.leaguer_type ==3}}
				img(src='${relativePath}/static/imgs/zsy.png')
				| {{/if}}
		| {{/each}}
	//- 推荐公司模板
	script#companys(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		div.hots.hotscom.fl
			ul.list-box
				li
					img.fl.hot-img(src="{{arr.company_logo}}")
					div.right-con.fl
						p.nowrap.com-name 
							| {{arr.name}}
							| {{if arr.leaguer_type ==2}}
							img(src="${relativePath}/static/imgs/zsr.png")
							| {{else if arr.leaguer_type ==1}}
							img(src="${relativePath}/static/imgs/zsb.png")
							| {{else if arr.leaguer_type ==3}}
							img(src="${relativePath}/static/imgs/zsy.png")
							| {{/if}}
						div.center
							div.litte.nowrap.years.fl
								| {{if arr.auth =='4'}}
								img(src="${relativePath}/static/imgs/gsh.png")
								| {{else}}
								img(src="${relativePath}/static/imgs/gsg.png")
								| {{/if}}
								|   成立{{arr.year}}年
							div.litte.nowrap.address.fl
								img(src="${relativePath}/static/imgs/po.png")
								|   {{arr.area==''?'暂无':arr.area}}
							div.litte.nowrap.advice.fl
								|  {{arr.ad_market}}
							div.clearfix
						div.btm
							| {{set tag = arr.tags}}
							| {{each tag list}}
							| {{if list.color="blue"}}
							a.blue(href="javascript:;") {{list.name}}
							| {{else if list.color="green"}}
							a.green(href="javascript:;") 印刷设计
							| {{else if list.color="yellow"}}
							a.yellow(href="javascript:;") 亚克力板
							| {{/if}}
							| {{/each}}
					div.clearfix
		| {{/each}}
	//- 产品分类
	script#kindsone(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		li
			img.fl.hot-img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}
				div.center
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   成立{{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area==''?'暂无':arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.btm
					| {{set tag = arr.tags}}
					| {{each tag list}}
					| {{if list.color="blue"}}
					a.blue(href="javascript:;") {{list.name}}
					| {{else if list.color="green"}}
					a.green(href="javascript:;") 印刷设计
					| {{else if list.color="yellow"}}
					a.yellow(href="javascript:;") 亚克力板
					| {{/if}}
					| {{/each}}
			div.clearfix
		| {{/each}}
	//- 服务分类
	script#kindstwo(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		li
			img.fl.hot-img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}
				div.center
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   成立{{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area==''?'暂无':arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.btm
					| {{set tag = arr.tags}}
					| {{each tag list}}
					| {{if list.color="blue"}}
					a.blue(href="javascript:;") {{list.name}}
					| {{else if list.color="green"}}
					a.green(href="javascript:;") 印刷设计
					| {{else if list.color="yellow"}}
					a.yellow(href="javascript:;") 亚克力板
					| {{/if}}
					| {{/each}}
			div.clearfix
		| {{/each}}
		
block pageScript

	script.
		//- 全局变量
		var MENUID=8;
		var tagArr = [];
		$(function(){
			$("#colleague").addClass("active");
			$("#dzjg").click(function(){
				window.location.href='dzjG.html';
			});
			$("#index").click(function(){
				window.location.href='materIndex.html';
			});
			$("#cpcl").click(function(){
				window.location.href='materFinished.html';
			});
			$("#hyfw1").click(function(){
				window.location.href='industryServiceIndex.html';
			});
			/*商品列表点击跳转*/
			$(".meterList").on("click","li img:not(:first)",function(){
				window.location.href="../../view/shopping/madeProcess_d.html?id="+$(this).closest("li").attr("num");
			})

			//- 点击发布需求
			$(".meterList").on("click","li:first-child",function() {
				window.location.href="../../view/shopping/newOrder.html?id="+$(this).closest("li").attr("num");
				
			})

			$(".left span").click(function(){
				$(this).addClass("current").siblings().removeClass("current");
			})
			$('.olList').css({'display':'none'})
			//- 成品材料一级导航
		    $.getJSON(shopIp+"/Category/homePageList?callback=?", {
				userToken:token,
				category_id:8,
				os:"web"
		      },function(data){
				var data = data.data;
				for(var i=0;i<data.length;i++) {
					var oneList = template("oneList",data[i]);
					$(".olList").append(oneList);
				}
		      });
			//- 二级导航
			$(".olList").on("mouseenter","li",function(){
				var parent_id = $(this).attr("id");
				var parent_name = $(this).text();
				$.getJSON(shopIp+"/Category/getSubCates?callback=?", {
					userToken:token,
					category_id:8,
					parent_id:parent_id,
					os:"web"
				},function(data){
					data.parent_name = parent_name;
					$(".rightMenu").html(template("twoList",data));
		      	})
		    })
		    //- 二级导航点击
		    
			$(".rightMenu").on("click","li",function(){
				//window.location.href='dzjG.html?id='+$(this).attr("code")+'&userToken='+token+'';
				MENUID=$(this).attr("code");
				zhList(1);
			});

			//- 点击个人进入个人店铺
			$(".friends-box").on("click",".row-box",function(){
				console.log($(this).attr('id'))
				window.location.href = 'http://localhost:8080/index.html?userid='+$(this).attr('id')
			})
			//- 获取同行首页数据
			//- 热门推荐
			$.post(shopIp+'/peer/recommendCompany',{
				userToken:token,
				size:4
			},function(res) {
				var hotList = res.data
				var hot = template("hot",res);
				$(".hotlist-box").append(hot);
			})
			//- 最新收录
			$.post(shopIp+'/peer/newCompany',{
				userToken:token,
				size:4
			},function(res) {
				var hotList = res.data
				var hot = template("newlist",res);
				$(".newlist-box").append(hot);
			})
			//- 推荐朋友
			$.post(shopIp+'/peer/recommendUser',{
				userToken:token,
				size:4
			},function(res) {
				var hotList = res.data
				var hot = template("frilist",res);
				$(".friends-box").append(hot);
			})
			//- 推荐朋友
			$.post(shopIp+'/peer/recommendCompany',{
				userToken:token,
				size:4,
				sort_new:1
			},function(res) {
				var hotList = res.data
				var hot = template("companys",res);
				$(".hotbox").append(hot);
			})
			//- 获取一级产品分类
			function getOne(type) {
				$.post(shopIp+'/peer/listClassification',{
					userToken:token,
					type:type
				},function(res) {
					var list = res.data
					if(type == 1) {
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.one').append(ele)
						}
						getTwo(1,list[0].id)
					}else{
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.service1').append(ele)
						}
						getTwo(2,list[0].id)
					}
				})
			}
			getOne(1)
			getOne(2)
			//- 获取二级分类
			$('.one').change(function() {
				var id = $(this).val()
				getTwo(1,id)
			})
			$('.two').change(function() {
				var id = $(this).val()
				threeList(1,id)
			})
			$('.service1').change(function() {
				var id = $(this).val()
				getTwo(2,id)
			})
			$('.service2').change(function() {
				var id = $(this).val()
				threeList(2,id)
			})
			function getTwo(distk,id) {
				$.post(shopIp+'/category/homePageList',{
					userToken:token,
					category_id:id
				},function(res) {
					var list = res.data
					if(distk == 1) {
						$('.two').empty()
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.two').append(ele)
						}
						threeList(1,list[0].id)
					}else{
						$('.service2').empty()
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.service2').append(ele)
						}
						threeList(2,list[0].id)
					}
				})
			}
			//- 获取三级分类
			function threeList(distk,id) {
				$.post(shopIp+'/category/getSubCates',{
					userToken:token,
					parent_id:id
				},function(res) {
					var list = res.data
					if(distk == 1) {
						$('.three').empty()
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.three').append(ele)
						}
						getKinds(1,$('.three').val())
					}else{
						$('.service3').empty()
						for(var i=0;i<list.length;i++) {
							var ele = '<option value='+list[i].id+'>'+list[i].name+'</option>'
							$('.service3').append(ele)
						}
						getKinds(2,$('.service3').val())
					}
				})
			}
			//- 获取分类列表
			function getKinds(kind,tag) {
				$.post(shopIp+'/peer/searchByCategory',{
					userToken:token,
					size:4,
					tags:tag,
					type:1
				},function(res) {
					var hotList = res.data
					if(kind ==1) {
						var hot = template("kindsone",res);
						$(".kindsonelist").empty()
						if(hotList.companys.length == 0) {
							$(".kindsonelist").append('<li style="text-align:center">暂无分类</li>')
						}else{
							$(".kindsonelist").append(hot);
						}
					}else{
						var hot = template("kindstwo",res);
						$(".kindstwolist").empty()
						if(hotList.companys.length == 0) {
							$(".kindstwolist").append('<li style="text-align:center">暂无分类</li>')
						}else{
							$(".kindstwolist").append(hot);
						}
					}
				})
			}
		})

		